<template>
	<div class="msg">
		<view>
			<view class="msgTitle">基本信息</view>
			<view class="inputStyle">
				<text class="message">姓名</text>
				<text class="messageRight">{{dataList.name}}</text>
			</view>
			<view class="inputStyle">
				<text class="message">性别</text>
				<text class="messageRight">{{dataList.sex}}</text>
			</view>
			<view class="inputStyle">
				<text class="message">民族</text>
				<view class="msgImg"></view>
				<text class="messageRight">{{dataList.nation}}</text>
			</view>
			<view class="inputStyle">
				<text class="message">政治面貌</text>
				<text class="messageRight">{{dataList.political}}</text>
			</view>
			<view class="inputStyle">
				<text class="message">地区</text>
				<view class="msgImg"></view>
				<text class="messageRight">{{dataList.region}}</text>
			</view>
			<view class="inputStyle">
				<text class="message">毕业中学</text>
				<text class="messageRight">{{dataList.midSchool}}</text>
			</view>
			<view class="inputStyle">
				<text class="message">学号</text>
				<text class="messageRight">{{dataList.canNum}}</text>
			</view>
			<view class="inputStyle">
				<text class="message">招生类别</text>
				<text class="messageRight">{{dataList.category}}</text>
			</view>
		</view>
		
		<view class="stuMsg">
			<view class="msgTitle">学生信息</view>
			<view class="inputStyle">
				<text class="message">学院</text>
				<input class="messageRight" placeholder="请填写" v-model="formData.college"/>
			</view>
			<view class="inputStyle">
				<text class="message">专业</text>
				<input class="messageRight" placeholder="请填写" v-model="formData.major" />
			</view>
			<view class="inputStyle">
				<text class="message">班级</text>
				<input class="messageRight" placeholder="请填写" v-model="formData.class" />
			</view>
			<view class="inputStyle">
				<text class="message">学历</text>
				<input class="messageRight" placeholder="请填写" v-model="formData.education" />
			</view>
		</view>
		
		<button type="default" class="loginBtn" @click="save">保存</button>
		
	</div>
</template>

<script>
	const {stuMsg,getStudent} = require('../../utils/api.js')
	export default {
		data() {
			return {
				index: 0,
				region: ['江西', '福建', '湖南'],
				dataList:{},
				formData:{
					canNum:'',
					college:'',
					major:'',
					class:'',
					education:''
				}
			}
		},
		created() {
			this.dataList = uni.getStorageSync('stu');
			getStudent().then(data=>{
				if(data.code === 200){
					this.formData = data.data;
				}
			})
		},
		methods:{
			save(){
				stuMsg(this.formData).then(data=>{
					if(data.code === 200){
						uni.showModal({
							content: data.msg,
							showCancel: false
						});
					}
				})
			},
			inputClick(id){
				this.id = id;
			},
			bindPickerChange: function(e) {
				this.index = e.target.value;
				if(this.id == 'region'){
					this.stu.region = this.region[this.index];
				}
			}
		}
	}
</script>

<style scoped src="../../static/css/login.css"></style>
<style scoped src="../../static/css/my.css"></style>
